<?php
include 'include/init.php';

include 'include/mysql.config.php';
include 'include/common.fun.php';

islogin();
include 'data/admin_data.php';

if($_POST['username']){
	$username=$_POST['username'];
	$sql="SELECT * from wd_user where user_name='$username'";
	$user=$db->getAll($sql);
	if ($user) {
		echo 1;
	}else{
		echo 0;
	}
}


if ($_GET['uid']) {
	$uId=$_GET['uid'];
if($uId==1){
	alert('非法访问');exit;
	}
	$sql="SELECT * from wd_admin where admin_id=$uId";
	$status=$db->getOne($sql);
	if ($status['admin_status']==1&&$adminId==1) {
		$res=0;
	}else{
		$res=1;
	}
	$arr=array('admin_status'=>$res);
	$where='admin_id='.$uId;
	$up=$db->update('wd_admin',$arr,$where);
	if ($up) {
		echo 1;
	}else{
		echo 0;
	}
}

if($_POST['districtid']){
	$districtid=$_POST['districtid'];
	$sql="SELECT * from wd_district where parentid='$districtid'";
	$district=$db->getAll($sql);
	echo json_encode($district);
}


 ?>